#!/usr/bin/env python
# -*- coding: utf-8 -*-

# @Time    : 2021/3/9 22:03
# @Author  : Keyman
# @File    : R-2.4.py


class Flower:
    """构造一个花类，包括名字，花瓣数和价格"""

    __slots__ = 'set_petals', 'set_price'

    def __init__(self, name: str = '', petal: int = 0, price: float = 0.0):
        self._name = name
        self._petal = petal
        self.price = price

    def set_name(self, name: str):
        self._name = name

    def __str__(self):
        return self._name

    def set_price(self, price: float):
        self.price = price
        return self.price

    def set_petals(self, petal: int):
        self._petal = petal
        return self._petal

    @classmethod
    def print_all(cls):
        return f"花的名字为{cls._name}\n花瓣数为{cls._petal}\n价格为{cls.price}"


if __name__ == '__main__':
    pass
